package com.huishu.user.controller;


import com.huishu.commons.pojo.BasePage;
import com.huishu.commons.pojo.Result;
import com.huishu.user.pojo.model.IconDO;
import com.huishu.user.service.IconService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author generator@ljj
 * @since 2023-07-03
 */
@RestController
@RequestMapping("/icon")
public class IconController {

    @Autowired
    private IconService iconService;

    @PostMapping("/pageList")
    public Result pageList(@RequestBody BasePage basePage) {
        return iconService.pageList(basePage);
    }

    @PostMapping("/createOrUpdate")
    public Result createOrUpdate(@RequestBody IconDO iconDO) {
        return iconService.saveOrUpdate(iconDO) ? Result.success() : Result.fail();
    }

    @GetMapping("/find")
    public Result find() {
        return Result.success(iconService.list());
    }
}
